package com.ss.android.article.base.utils;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.bytedance.common.utility.Logger;
import java.lang.ref.WeakReference;

public final class f {
    public static final boolean a;

    static {
        a = Logger.debug();
    }

    public static void a(Activity arg5) {
        if((f.a) && arg5 != null && !arg5.isFinishing()) {
            View v0 = arg5.getWindow().getDecorView();
            v0.postDelayed(new g(new WeakReference(v0), arg5.getApplication(), arg5.getClass().getSimpleName()), 1000);
        }
    }

    static int a(Context arg4, View arg5, int arg6) {
        if((arg5 instanceof ViewGroup)) {
            int v1 = 0;
            int v0 = arg6;
            while(v1 < ((ViewGroup)arg5).getChildCount()) {
                v0 = Math.max(f.a(arg4, ((ViewGroup)arg5).getChildAt(v1), arg6 + 1), v0);
                ++v1;
            }

            arg6 = v0;
        }
        else if(arg6 > 19) {
            arg5.post(new i(arg4, arg5, arg6));
        }

        return arg6;
    }

    static void a(View arg5, Resources arg6, int arg7) {
        String v0_1;
        while(f.a) {
            if(arg5 == null) {
                return;
            }

            if(arg6 == null) {
                return;
            }

            int v0 = arg5.getId();
            String v1 = "ViewDepthUtils";
            StringBuilder v2 = new StringBuilder("ViewTree[depth:").append(arg7).append("]:");
            if(v0 > 0) {
                v0_1 = "id " + arg6.getResourceEntryName(v0);
            } else {
                v0_1 = arg5.getClass().toString();
            }

//            Logger.b(v1, v2.append(v0_1).toString());
            ViewParent v0_3 = arg5.getParent();
            if(!(v0_3 instanceof View)) {
                return;
            }
            --arg7;
            arg5 = (View) v0_3;
        }
    }
}

